<template>
  <div>
    <h1 ref="myH1">1. ref获取原生dom</h1>
    <button @click="fn">点击修改上面内容</button>
    <Demo ref="reference"/>
    <button @click="fn1">点击</button>
  </div>
</template>

<script>
import Demo from "./components/Demo";
export default {
  components:{
    Demo
  },
  methods: {
    fn() {
      console.log(this.$refs.myH1); // <h1></h1> 原生DOM标签
      this.$refs.myH1.innerHTML = "改内容了";
    },
    fn1(){
      this.$refs.reference.ind = Math.floor(Math.random()*3)
      console.log(this.$refs.reference);
    }
  }
}
</script>